package com.akk.module.avs.service;

import com.akk.module.avs.entity.AvsPayAccess;
import com.akk.module.avs.entity.AvsPayAccessExample;
import com.akk.module.avs.mapper.AvsPayAccessMapper;
import com.akk.module.avs.mapper.dao.AvsPayAccessDao;
import com.akk.module.avs.model.response.AvsPayAccessRes;
import com.akk.module.avs.model.response.AvsPayAllAccessRes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AvsPayAccessService {

    @Autowired
    private AvsPayAccessExample payAccessExample;

    @Autowired
    private AvsPayAccessMapper payAccessMapper;

    @Autowired
    private AvsPayAccessDao payAccessDao;

    public List<AvsPayAccessRes> accessList(){
        return payAccessDao.queryListWithAccessName();
    }

    public List<AvsPayAccessRes>payAccessRestList(){
        return payAccessDao.payAccessRestList();
    }

    public AvsPayAccess queryById(String accessId){
        return payAccessMapper.selectByPrimaryKey(accessId);
    }
    public List<AvsPayAccess> queryByAccessId(String accessId){
        payAccessExample.clear();
        payAccessExample.createCriteria().andAccessIdEqualTo(accessId);
        return payAccessMapper.selectByExample(payAccessExample);
    }

    public void update(AvsPayAccess avsPayAccess){
        payAccessMapper.updateByPrimaryKey(avsPayAccess);
    }

    public List<AvsPayAllAccessRes> allAccess(){
        return payAccessDao.allAccess();
    }

    public void save(AvsPayAccess payAccess) {
        payAccessMapper.insert(payAccess);
    }
}
